package com.liuyi.netty.im.lychat.config;

import com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

import java.util.function.Predicate;

/**
 * @author Mr.Fmy
 * @since 2021/12/25
 */
@Configuration
@EnableSwagger2WebMvc
public class SwaggerConfig extends SwaggerAbstractConfig{

    public SwaggerConfig(OpenApiExtensionResolver openApiExtensionResolver) {
        super(openApiExtensionResolver);
    }

    @Override
    protected Predicate<String> securitySelector() {
        return PathSelectors.ant("/**");
    }

    @Override
    protected String getVersion() {
        return "1.0.3";
    }

    @Bean("docketInfo")
    public Docket docketInfo() {
        String groupName = "lychat-redis";
        return docketRapid(groupName, groupName.concat("api文档"), "", "com.liuyi.netty.im.lychat.modular.control");
    }
}
